﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace spriteData
{
    class XModuleInFrame
    {
        private int moduleId;
        private int x;
        private int y;
        public int ModuleId
        {
            get { return this.moduleId; }
            set { this.moduleId = value; }
        }
        public int X
        {
            get { return this.x; }
            set { this.x = value; }
        }
        public int Y
        {
            get { return this.y; }
            set { this.y = value; }
        }
        public void serial(BinaryWriter  bw)
        {
            bw.Write(moduleId);
            bw.Write(x);
            bw.Write(y);
        }
    }
    class XFrame
    {
        public XFrame()
        {
            modules = new List<XModuleInFrame>();
            attackRects = new List<XRectangle>();
        }
        private int id;
        public  List<XModuleInFrame> modules;
        public List<XRectangle> attackRects;
        public int Id
        {
            get { return this.id; }
            set { this.id = value; }
        }
        public void serial(BinaryWriter  bw)
        {
            bw.Write(id);
            bw.Write(modules.Count);
            foreach (XModuleInFrame module in modules)
            {
                module.serial(bw);
            }
            bw.Write(attackRects.Count);
            foreach (XRectangle rect in attackRects)
            {
                rect.serial(bw);
            }
        }

    }
}
